<!DOCTYPE html>
<html lang='en'>

<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0, user-scalable=no">
    <title>Document</title>
    <script src='https://cdn.jsdelivr.net/npm/vue/dist/vue.js'></script>
</head>
  <style>
    .getcolor{
      color: red;
      font-size: 200px;
    }
  </style>
<body>
    <div id='box' >
     <ul>
        <li v-for= "(m,index ) in books" @click="change(index)" :class="{getcolor:index === yes}">{{m}}</li>
     </ul>
    </div>
    <script>
        var vm = new Vue({
            el: '#box',
            data: {
                 books:["海王","海绵宝宝","海贼王","火影忍者","代码大全"],
                 yes:0,
                 

            },  
            methods: {
                 change:function(index){
                   this.yes = index 
                 }
            }
        })
    </script>
</body>

</html>
